#pragma once
#include <string>
#include "logs/log.hpp"

class Logger {
public:
    static Logger& getInstance() {
        static Logger instance; // 在第一次使用时初始化
        return instance;
    }

    wu::Logger::ptr loggger() {
        return logger_;
    }
private:
    Logger() {
        std::unique_ptr<wu::LoggerBuilder> build(new wu::GlobalLoggerBuilder());
        build->buildLoggerName("async-logger");
        // build->buildFormatter("[%c][%f:%l][%p]%m%n");
        build->buildLoggerLevel(wu::LogLevel::value::INFO);
        build->buildSink<wu::StdoutSink>();
        build->buildSink<wu::FileSink>("./filelog/async.log");
        logger_ = build->build();

    } 
    Logger(const Logger&) = delete;
    void operator=(const Logger&) = delete;
private:
    wu::Logger::ptr logger_;
};
